package com.lxt;

import org.springframework.context.annotation.Configuration;

import javax.annotation.PostConstruct;

/**
 * @author kevin.lv
 * @date 2023/2/7 16:32
 * @desc es中关于netty的报错 Caused by: java.lang.IllegalStateException: availableProcessors is already set to [8], rejecting [8]
 * 原因是因为启动服务时elasticsearch连接与redis共用了netty连接，从而导致了冲突，从报错也能看出来已经告知已被占用。解决的思路就是让elasticsearch暂缓使用
 */
@Configuration
public class ESConfig {

    @PostConstruct
    void init() {
        System.setProperty("es.set.netty.runtime.available.processors", "false");
    }
}
